package com.googlecode.project4uz.demo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;

/**
 * Prosta klasa, ktora serializujemy i deserializujemy
 * serializerem pol publicznych.
 * 
 * @author Daniel Kur
 */
public class ClassForSerialize implements Serializable
{
	private static final long serialVersionUID = 6340207029710356347L;
	public double liczbaRzeczywista;
	public boolean[] tabLogiczna;
	public InnerClass klasaWewnetrzna;
	public RefForSerialize klasaZewnetrzna;
	public RefForSerialize[] tabRef1D;
	public String[] tabTekst;
	public char[][] tabZnakow;
	public InnerClass[][] tabRef;
	public ArrayList<Integer> listaArrayInt;
	public LinkedList<Integer> listaLinkedInt;
	public LinkedList<InnerClass> listaRef;
	public HashMap<InnerClass, RefForSerialize> mapaRef;
	
	public class InnerClass
	{
		public short liczba;
		public String tekst;
		
		public InnerClass()
		{
			this.liczba = 1000;
		}
	}
	
	public ClassForSerialize()
	{
		this.liczbaRzeczywista = 1234567890.0987654321;
		this.klasaWewnetrzna = new InnerClass();
		this.klasaZewnetrzna = new RefForSerialize();
		
		this.tabRef1D = new RefForSerialize[3];
			tabRef1D[2] = new RefForSerialize();
		
		this.tabTekst = new String[3];
			tabTekst[0] = "Ala ma zyrafe!";
			
		this.tabZnakow = new char[2][];
			//this.tabZnakow[0] = new char[2];
			//	this.tabZnakow[0][0] = 'a';
			//	this.tabZnakow[0][1] = 'b';
			this.tabZnakow[1] = new char[2];	
				this.tabZnakow[1][0] = 'x';
				this.tabZnakow[1][1] = 'y';
				
		this.tabRef = new InnerClass[2][];
			this.tabRef[0] = new InnerClass[2];
				this.tabRef[0][0] = new InnerClass();
				this.tabRef[0][1] = new InnerClass();
			//this.tabRef[1] = new InnerClass[2];
			//	this.tabRef[1][0] = new InnerClass();
			//	this.tabRef[1][1] = new InnerClass();
				
		listaArrayInt = new ArrayList<Integer>();
		listaArrayInt.add(4);
		listaArrayInt.add(9);
		listaArrayInt.add(13);
		
		listaLinkedInt = new LinkedList<Integer>();
		listaLinkedInt.add(16);
		listaLinkedInt.add(24);
		listaLinkedInt.add(135);
				
		listaRef = new LinkedList<InnerClass>();
			listaRef.add(new InnerClass());
			listaRef.add(new InnerClass());
			
		mapaRef = new HashMap<InnerClass, RefForSerialize>();
			mapaRef.put(new InnerClass(), new RefForSerialize());
			mapaRef.put(new InnerClass(), new RefForSerialize());
	}
}
